package com.shyfu.services;

import com.shyfu.dao.RoleDAO;
import com.shyfu.entities.Role;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Svitlana on 04-Apr-14.
 */
@Service
public class RoleServiceImpl implements RoleService {

    @Autowired
    private RoleDAO roleDAO;

    @Override
    @Transactional
    public void addRole(Role role) {
        roleDAO.addRole(role);
    }

    @Override
    @Transactional
    public void removeRole(Role role) {
        roleDAO.removeRole(role);
    }

    @Override
    @Transactional
    public void removeRole(long id) {
        roleDAO.removeRole(id);
    }

    @Override
    @Transactional
    public List<Role> getAllRoles() {
        return roleDAO.getAllRoles();
    }

    @Override
    @Transactional
    public Role getRole(long id) {
        return roleDAO.getRole(id);
    }
}
